Skip to content

Conversation

yucai-intel
Copy link
Contributor

Fixed the following issues found by test/test_nn.py::TestNNDeviceTypeXPU::test_avg_pool_large_tensor2_xpu

  1. A segmentation fault caused by a data type conversion error that invalidated the memory address.
  2. A calculation error caused by data overflow.

@yucai-intel
Copy link
Contributor Author

image

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes critical issues in the AveragePool2dKernel implementation for XPU devices, specifically addressing a segmentation fault and calculation error that were causing test failures.

  • Replaced direct index access with XPU_KERNEL_LOOP macros for safer kernel iteration
  • Changed data types from index_t to int64_t for better overflow handling
  • Added group_size limit to prevent exceeding hardware capabilities

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@CuiYifeng CuiYifeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if test_avg_pool_large_tensor2_xpu is activated in CI.
The rest of this PR looks good to me.

@CuiYifeng CuiYifeng requested a review from guangyey September 24, 2025 08:56
Copy link
Contributor

@guangyey guangyey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, otherwise, LGTM.

@CuiYifeng CuiYifeng added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit f301733 Sep 30, 2025
25 checks passed
@CuiYifeng CuiYifeng deleted the yucai/averagepool2d/fix branch September 30, 2025 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants